#include "GMSKeyDown.h"
#include "Factory.h"
#include "TimerMS.h"
#include "SendGameMessage.h"
#include "ServerManager.h"
#include "GMSetVel.h"

#include <iostream>

GMSKeyDown::GMSKeyDown()
{
	m_id = -1;
}

void GMSKeyDown::Execute()
{
	GMSetVel sv;
	sv.SetID(m_id);
	sv.SetVelZ(-2.0f);
	sv.SetVelX(0.0f);
	sv.SetVelY(0.0f);
	TheServerManager::Instance()->SendGameMessageToAll(sv);
}

bool GMSKeyDown::Read(SocketMessage* sm)
{
	sm->ReadInt(&m_id);
	
	return true;
}

void GMSKeyDown::Write(SocketMessage* sm)
{
	sm->WriteString("GMSKeyDown");
	sm->WriteInt(m_id);
}

void GMSKeyDown::SetID(int i)
{
	m_id = i;
}

int GMSKeyDown::GetID() const
{
	return m_id;
}